<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>添加印章</title>
</head>
<body class="layui-layout-body">

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="body_right">
            <h4 class="nav_title">添加印章</h4>
            <form class="layui-form" action="">
			
				  <div class="layui-form-item">
		              <label for="sealName" class="layui-form-label">
		                  印章名称
		              </label>
		              <div class="layui-input-inline">
		                  <input type="text" id="sealName" name="sealName" required="" lay-verify="sealName" autocomplete="off" class="layui-input">
		              </div>
		              <div class="layui-form-mid layui-word-aux">
		                  <span class="x-red">如：财务印章</span>
		              </div>
		          </div>
		          
		          <div class="layui-form-item">
		              <label for="description" class="layui-form-label">
		                  印章描述
		              </label>
		              <div class="layui-input-inline" style="width:150px">
			                <textarea name="description" placeholder=如仅限财务财务人员使用" class="layui-textarea"></textarea>
			          </div>
		          </div>
		          
		          <div class="layui-form-item">
		              <label for="isForcedPhoto" class="layui-form-label">
		                  强制拍照
		              </label>
		              <div class="layui-input-inline" style="width:80px">
				        <input type="checkbox" name="isForcedPhoto" lay-filter="isForcedPhoto" value="N" id="isForcedPhoto"  lay-skin="switch" lay-text="是|否">
				       </div>
				       <div class="layui-form-mid layui-word-aux">
		                  <span class="x-red">启用盖章时必须拍照上传</span>
		              </div>
		          </div>
		          
		          <div class="layui-form-item">
		              <label for="model" class="layui-form-label">
		                  保管员
		              </label>
		              <div class="layui-input-inline layui-form-mid">
		              	<div id="custosInfo"></div>
		              	<a href="javascript:openwinx('选择保管员','/staff/selected/index.htm','1000','600');" class="layui-btn layui-btn-xs">选择保管员</a>
				      </div>
		          </div>
		          
		          <div class="layui-form-item">
		              <label for="model" class="layui-form-label">
		                  紧急申请
		              </label>
		              <div class="layui-input-inline" style="width:80px">
						<input type="text" id="limitUrgentApply" name="limitUrgentApply" value="0" required="" lay-verify="limitUrgentApply" autocomplete="off" class="layui-input">				      
					 </div>
					 <div class="layui-form-mid layui-word-aux">
		                  <span class="x-red">使用失误时，可紧急申请，无需审核</span>
		              </div>
		          </div>
		          <!--
		          <div class="layui-form-item">
		              <label for="model" class="layui-form-label">
		                  审核流程
		              </label>
		              <div class="layui-input-inline">
				          <select name="workflowId">
					        <option value="">暂不设置</option>
					        <#list workflows as item>
					        <option value="${item.workflowId}">${item.name}</option>
					        </#list>
					      </select>
				       </div>
				       <div class="layui-form-mid layui-word-aux">
		                  <span class="x-red">如设置流程则简化申请流程</span>
		              </div>
		          </div>
		          -->
		          <div class="layui-form-item">
		              <label for="L_repass" class="layui-form-label">
		              </label>
		              <button class="layui-btn layui-btn-danger" lay-filter="add" lay-submit="">增加</button>
		          </div>
				
	        	</form>
        </div>
     </div>
  
     
     <script>
     
        //JavaScript代码区域
        layui.use(['element','form','layedit','laypage'], function(){
            var element = layui.element;
            var form = layui.form;
            var   layer = layui.layer;
            
            
            form.verify({
			  sealName: function(value, item){ //value：表单的值、item：表单的DOM对象
			    
			    if(!value){
			      return '印章名称不能为空';
			    }
			  },
			  partyId: function(value, item){ //value：表单的值、item：表单的DOM对象
			    
			    if(!value){
			      return '请选择保管员';
			    }
			  }
			});      
            
            
            form.on('switch(isForcedPhoto)', function(data){
            
            		if(data.elem.checked){
            			$(this).val("Y")
            		}else{
            			$(this).val("N")
            		}
			});  
          	
          //监听提交
            form.on('submit(add)', function(data){
            		var field = data.field;
            		console.log(field);
            	   $.ajax({
					type:"POST", 
					url:"/seal/create.htm",
					data:field,
					success:function(result) {
						if(result.code=='1'){
							layer.alert("添加成功", {icon: 6},function () {
				            		location.href="/seal/list.htm";
				       		});
						}else{
						 	layer.msg(result.msg);
						}
				 	} 
				});
           
                return false;
            });
        });
    </script>   
     
     
</body>
</html>